package com.hzw.service;

import com.hzw.api.IOrderCommodityService;
import com.hzw.dao.OrderCommodityDao;
import com.hzw.entity.OrderCommodity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class OrderCommodityService implements IOrderCommodityService {

    @Autowired
    OrderCommodityDao orderCommodityDao;

    @Override
    public void insert(OrderCommodity orderCommodity) {
        orderCommodity.setId(UUID.randomUUID().toString().replace("-", ""));
        orderCommodityDao.insert(orderCommodity);
    }

    @Override
    public void delete(OrderCommodity orderCommodity) {
        orderCommodityDao.delByOrderId(orderCommodity);
    }

    @Override
    public void update(OrderCommodity orderCommodity) {
        orderCommodityDao.updateByOrderId(orderCommodity);
    }

    @Override
    public List<OrderCommodity> select(OrderCommodity orderCommodity) {
        return orderCommodityDao.select(orderCommodity);
    }
}
